package com.woniuxy.education.mapper;

import com.woniuxy.education.entity.Role;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface RoleMapper {
    //通过用户id去role,user_role做链表查询
    @Select("select * from user_role ur,role r where ur.rid =r.id and ur.uid=#{uid}")
    @Results({
            @Result(id = true,column = "rid",property = "id"),
            @Result(column = "rid",property = "perms",
                    many = @Many(select = "com.woniuxy.shiro.mapper.PermMapper.findPermsByRid")),

    })
    public List<Role> findRolesById(int uid);
}
